<?php
/**
 * classe que representa as compras de lances feitas pelo cliente
 * @access public
 * @author Magno Leal
 * @package model
 */
class CompraBean {

    private $compraID;
    private $data;
    private $ip;
    /**
     * @NotEmptyValidator
     */
    private $valor;
    private $pacoteLance;
    private $cliente;
    private $status;

    function __construct($compraID = 0, $data = "", $ip = "", $valor = -1, $pacoteLance = null, $cliente = null, $status = null) {
        $this->compraID = $compraID;
        $this->valor = $valor;
        $this->data = $data;
        $this->ip = $ip;
        $this->pacoteLance = $pacoteLance;
        $this->cliente = $cliente;
        $this->status = $status;
    }

    public function getCompraID() {
        return $this->compraID;
    }

    public function setCompraID($compraID) {
        $this->compraID = $compraID;
    }

    public function getValor() {
        return $this->valor;
    }

    public function setValor($valor) {
        $this->valor = $valor;
    }

    public function getData() {
        return $this->data;
    }

    public function setData($data) {
        $this->data = $data;
    }

    public function getIp() {
        return $this->ip;
    }

    public function setIp($ip) {
        $this->ip = $ip;
    }

    public function getStatus() {
        return $this->status;
    }

    public function setStatus($status) {
        $this->status = $status;
    }

    public function getCliente() {
        return $this->cliente;
    }

    public function setCliente($cliente) {
        $this->cliente = $cliente;
    }

    public function getPacoteLance() {
        return $this->pacoteLance;
    }

    public function setPacoteLance($pacoteLance) {
        $this->pacoteLance = $pacoteLance;
    }

    public function toJson() {
        return json_encode($this->toBD());
    }

    public function toBD() {
        $compra = array();

        $compra['compraID'] = $this->compraID;
        $compra['valor'] = $this->valor;
        $compra['data'] = $this->data;
        $compra['ip'] = $this->ip;
        $compra['pacoteLanceID'] = $this->pacoteLance->getPacoteLanceID();
        $compra['clienteID'] = $this->cliente->getUsuarioID();
        $compra['statusID'] = $this->status->getStatusID();

        return $compra;

    }
}
?>
